//
//  QYXFindMoreCollectionViewCell.m
//  OpenYourEyes
//
//  Created by dllo on 16/6/6.
//  Copyright © 2016年 Google AdWords. All rights reserved.
//

#import "QYXFindMoreCollectionViewCell.h"

@interface QYXFindMoreCollectionViewCell ()

@property (weak, nonatomic) IBOutlet UIImageView *backImgaeView;
@property (nonatomic, strong) UIView *coverView;

@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@end


@implementation QYXFindMoreCollectionViewCell


- (void)setModel:(QYXFindMoreModel *)model
{
    if (_model != model) {
        _model = model;
    }
    
    [self.backImgaeView sd_setImageWithURL:[NSURL URLWithString:_model.image] placeholderImage:kPlaceHolderImage];
    self.titleLabel.text = _model.title;
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.coverView = [[UIView alloc] init];
    [self.backImgaeView addSubview:self.coverView];
    self.coverView.backgroundColor = [UIColor colorWithWhite:0.000 alpha:0.200];
    
    UILongPressGestureRecognizer *longTap = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longTap:)];
    [self addGestureRecognizer:longTap];
    
}

#pragma mark - 长按手势

- (void)longTap:(UILongPressGestureRecognizer *)sender
{
    self.titleLabel.textColor = [UIColor colorWithWhite:1.000 alpha:0.000];
    self.coverView.backgroundColor = [UIColor clearColor];
     if (sender.state == UIGestureRecognizerStateEnded) {
         self.coverView.backgroundColor = [UIColor colorWithWhite:0.000 alpha:0.200];
         self.titleLabel.textColor = [UIColor whiteColor];

     }
    
}


- (void)layoutSubviews
{
    [super layoutSubviews];
    self.coverView.frame = self.bounds;
}
@end
